'''
假设你正在开发一个简单的学生成绩管理系统。
你需要实现一个函数，用于计算学生的平均成绩，
并根据平均成绩给出相应的等级评定。
scores = [85, 90, 78, 92, 88]
'''

scores = [85, 90, 78, 92, 88]
def stu (scores):
    #总成绩
    total = sum(scores)
    #平均成绩
    avg = total / len(scores)
    if avg >= 90:
        a = "A"
    elif avg >= 80:
        a = 'B'
    elif avg >=70:
        a = 'C'
    elif avg >= 60:
        a ='D '
    else:
        a = 'F'
    return avg , a 

# 测试数据
scores = [85, 90, 78, 92, 88]
avg,a = stu(scores)
print(f'平均成绩为：{avg:.2f}')
print(f'等级评定：{a}')

'''
def calculate_average_and_grade(scores):
    # 计算总成绩
    total_score = sum(scores)
    # 计算平均成绩
    average_score = total_score / len(scores)
    
    # 根据平均成绩给出等级评定
    if average_score >= 90:
        grade = 'A'
    elif average_score >= 80:
        grade = 'B'
    elif average_score >= 70:
        grade = 'C'
    elif average_score >= 60:
        grade = 'D'
    else:
        grade = 'F'
    
    return average_score, grade

# 测试数据
scores = [85, 90, 78, 92, 88]
average_score, grade = calculate_average_and_grade(scores)

print(f"平均成绩: {average_score:.2f}")
print(f"等级评定: {grade}")
'''